package org.mcjug.locationmailer.receiver;

import org.mcjug.locationmailer.util.AlarmManagerUtil;
import org.mcjug.locationmailer.util.Constants;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
//import android.util.//Log;

public class BootReceiver extends BroadcastReceiver {
    private final String TAG = BootReceiver.class.getSimpleName();

    public void onReceive(Context context, Intent callingIntent) {
        Context applicationContext = context.getApplicationContext();
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext);

        boolean startSendingEmail = prefs.getBoolean(Constants.PREFS_START_SENDING_EMAIL_KEY, false);
        if (startSendingEmail) {
            new AlarmManagerUtil(applicationContext).updateAlarm();
        }

        //Log.d(TAG, "onReceived");
    }
}
